package com.jubao.modules.sys.controller;

import java.util.Map;

import com.jubao.modules.sys.entity.BankTypeEntity;
import com.jubao.modules.sys.service.BankTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jubao.common.annotation.SysLog;
import com.jubao.common.entity.Page;
import com.jubao.common.entity.R;

/**
 * 资产类型
 * @author jubaodai<363217237@qq.com>
 */
@RestController
@RequestMapping("/sys/banktype")
public class BankTypeController extends AbstractController {
	
	@Autowired
	private BankTypeService bankTypeService;
	
	/**
	 * 列表
	 * @param params
	 * @return
	 */
	@RequestMapping("/list")
	public Page<BankTypeEntity> list(@RequestBody Map<String, Object> params) {
		return bankTypeService.listBankType(params);
	}
		
	/**
	 * 新增
	 * @param bankType
	 * @return
	 */
	@SysLog("新增资产类型")
	@RequestMapping("/save")
	public R save(@RequestBody BankTypeEntity bankType) {
		return bankTypeService.saveBankType(bankType);
	}

	@RequestMapping("/typeNames")
	public R getTypeNames() {
		return bankTypeService.getTypeNames();
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@RequestMapping("/info")
	public R getById(@RequestBody Long id) {
		return bankTypeService.getBankTypeById(id);
	}
	
	/**
	 * 修改
	 * @param bankType
	 * @return
	 */
	@SysLog("修改资产类型")
	@RequestMapping("/update")
	public R update(@RequestBody BankTypeEntity bankType) {
		return bankTypeService.updateBankType(bankType);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除资产类型")
	@RequestMapping("/remove")
	public R batchRemove(@RequestBody Long[] id) {
		return bankTypeService.batchRemove(id);
	}
	
}
